﻿<%@ Page Title="Post Requests - Savory Housing" Language="C#" MasterPageFile="~/RealState.Master" EnableEventValidation="false" AutoEventWireup="true" CodeBehind="Real_Estate_Post_Request.aspx.cs" Inherits="WebApplication.Real_Estate_Post_Request" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
    <script type="text/javascript">
        $(document).ready(function () {
            $('#<%=ddlCountry.ClientID%>').change(getCity);
            $('#<%=ddlProperty.ClientID%>').change(getProperty);
            $('#<%=ddlCountry.ClientID%>').change(getCurrency); 
            $('#<%=ddlCity.ClientID%>').append(new Option('City', 'City', false));
            $('#<%=ddlPropertyType.ClientID%>').append(new Option('Property Type', 'Property Type', false));


            $(":input[title]").each(function () {
                $(this).val($(this).attr("title"));
                $(this).bind('focus', function () {
                    if ($(this).val() == $(this).attr("title")) $(this).val('');
                });
                $(this).bind('blur', function () {
                    if ($(this).val() == '') $(this).val($(this).attr("title"));
                });
            });

        });

        function getProperty() {
            $("select[id$=ddlPropertyType] > option").remove();
            $('#<%=ddlPropertyType.ClientID%>').append(new Option('Property Type', 'Property Type', false));
            $.ajax({
                type: "POST",
                url: "/CountryService.asmx/GetPropertyType",
                data: "{Property: '" + $('#MainContent_ddlProperty').val() + "'}",
                contentType: "application/json; charset=utf-8",
                dataType: "json",
                success: function (response) {
                    var models = (typeof response.d) == 'string' ? eval('(' + response.d + ')') : response.d;
                    for (var i = 0; i < models.length; i++) {

                        var val = models[i];
                        var text = models[i];
                        $('#MainContent_ddlPropertyType').append(new Option(text, val, false));
                    }

                },
                error: function (XMLHttpRequest, textStatus, errorThrown) {
                }

            });
        }


        function getCity() {
            $("select[id$=ddlCity] > option").remove();
            $('#<%=ddlCity.ClientID%>').append(new Option('City', 'City', false));
            $.ajax({
                type: "POST",
                url: "/CountryService.asmx/GetCity",
                data: "{Country: '" + $('#MainContent_ddlCountry').val() + "'}",
                contentType: "application/json; charset=utf-8",
                dataType: "json",
                success: function (response) {
                    var models = (typeof response.d) == 'string' ? eval('(' + response.d + ')') : response.d;
                    for (var i = 0; i < models.length; i++) {
                        var val = models[i];
                        var text = models[i];
                        $('#MainContent_ddlCity').append(new Option(text, val, false));
                    }

                },
                error: function (XMLHttpRequest, textStatus, errorThrown) {
                }

            });
        }
        function getCurrency() {
            $.ajax({
                type: "POST",
                url: "/CountryService.asmx/GetCurrency",
                data: "{Country: '" + $('#MainContent_ddlCountry').val() + "'}",
                contentType: "application/json; charset=utf-8",
                dataType: "json",
                success: function (response) {
                    //var objectvalue = jQuery.parseJSON(response.d);
                    $('#MainContent_txtCurrency').val(response.d);

                },
                error: function (XMLHttpRequest, textStatus, errorThrown) {
                }

            });
        }
    </script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
<div class="left">
	   
        <div class="clear"></div>
        	<h3 class="white_db_box nfont dark_gray" style="width:255px; margin-left:15px;">Real Estate Post Request</h3>
            <div>
                <asp:RequiredFieldValidator ID="reqtxtContactNumber1" runat="server" Text="Please enter contact number 1" ControlToValidate="txtContactNumber1" CssClass="error" InitialValue="Contact Number 1" ErrorMessage="Please enter contact number 1"></asp:RequiredFieldValidator>
                <asp:RequiredFieldValidator ID="reqtxtContactName" runat="server" Text="Please enter contact name" ControlToValidate="txtContactName" CssClass="error" InitialValue="Contact Name" ErrorMessage="Please enter contact name"></asp:RequiredFieldValidator>
                <asp:CompareValidator ID="CompareValidator1" ErrorMessage="Min Price should be less than Max Price." CssClass="error" ControlToValidate="txtMaxPrice" ControlToCompare="txtMinPrice" Operator="GreaterThan" Type="Currency" runat="server" />
                <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" Text="*" ControlToValidate="txtMaxPrice" CssClass="error" InitialValue="Total Price" ErrorMessage="Please enter Max Price"></asp:RequiredFieldValidator>
                <asp:RequiredFieldValidator ID="reqtxtTotalPrice" runat="server" Text="*" ControlToValidate="txtMinPrice" CssClass="error" InitialValue="Total Price" ErrorMessage="Please enter Min Price"></asp:RequiredFieldValidator>
                <asp:RequiredFieldValidator ID="reqddlPriceMode" runat="server" ControlToValidate="ddlPriceMode" CssClass="error" InitialValue="Mode" ErrorMessage="Please select mode" Text="Please select mode"></asp:RequiredFieldValidator>
                <asp:RequiredFieldValidator ID="reqtxtArea" runat="server" ControlToValidate="txtArea" CssClass="error" InitialValue="Area in m2" ErrorMessage="Please enter area in m2" Text="Please enter area in m2"></asp:RequiredFieldValidator>
                <asp:RequiredFieldValidator ID="reqddlPropertyType" runat="server" ControlToValidate="ddlPropertyType" CssClass="error" InitialValue="Property Type" ErrorMessage="Please select property type" Text="Please select property type"></asp:RequiredFieldValidator>
                <asp:RequiredFieldValidator ID="reqddlProperty" runat="server" ControlToValidate="ddlProperty" CssClass="error" InitialValue="Category" ErrorMessage="Please select category" Text="Please select category"></asp:RequiredFieldValidator>
                <asp:RequiredFieldValidator ID="reqtxtLandline" runat="server" ControlToValidate="txtLandline" CssClass="error" InitialValue="Landline Number" ErrorMessage="Please enter landline number" Text="Please enter landline number"></asp:RequiredFieldValidator>
                <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="txtNeighborhood" CssClass="error" InitialValue="Neighborhood" ErrorMessage="Please enter your neighborhood" Text="Please enter your neighborhood"></asp:RequiredFieldValidator>
                <asp:RequiredFieldValidator ID="reqddlCity" runat="server" ControlToValidate="ddlCity" CssClass="error" InitialValue="City" ErrorMessage="Please select city" Text="Please select city"></asp:RequiredFieldValidator>
                <asp:RequiredFieldValidator ID="reqCountry" runat="server" ControlToValidate="ddlCountry" CssClass="error" InitialValue="Country" ErrorMessage="Please select country" Text="Please select country"></asp:RequiredFieldValidator>
            </div>
            <div class="clear"></div>
          	<dl class="form clearfix" style="margin-left:15px;">
            <dt>
            	<br />
                <p class="purple" style="padding:0px 0px 0px 0px;"><strong>Location</strong></p>
                <div style="height:5px;"></div>
                
             	<div class="res_ad">
                    <asp:DropDownList ID="ddlCountry" runat="server" CssClass="form-text wdth150"></asp:DropDownList>
				</div>
            
                <div class="res_ad">
                	<asp:DropDownList ID="ddlCity" runat="server" CssClass="form-text wdth150"></asp:DropDownList>
                </div>

                <div class="res_ad">
    				<asp:TextBox ID="txtNeighborhood" runat="server" MaxLength="20" CssClass="form-text wdth150_inp" title="Neighborhood"></asp:TextBox>
				</div>
            
            	<div class="res_ad">
    				<asp:TextBox ID="txtLandline" runat="server" MaxLength="20" title="Landline Number" CssClass="form-text wdth150_inp"></asp:TextBox>
				</div>
                
            	<div class="clear"></div>
                
            </dt>
            <dt>
            	<p class="purple" style="padding:10px 0px 0px 0px;"><strong>Real Estate</strong></p>
                <div style="height:5px;"></div>

             	<div class="res_ad">
				<asp:DropDownList ID="ddlProperty"  runat="server" CssClass="form-text wdth150"></asp:DropDownList>
                
                <div style="font-size:11px; color:#4F81BD; width:150px; padding:5px 0px 0px 0px;">Residential/Commercial Types</div>
			</div>
            
            <div class="res_ad">
				<asp:DropDownList ID="ddlPropertyType" runat="server" CssClass="form-text wdth150"></asp:DropDownList>
                
			</div>
            
            <div class="res_ad">
            <asp:TextBox ID="txtArea" runat="server" MaxLength="10" CssClass="form-text wdth150_inp" title="Area in m2" ></asp:TextBox>
            
				<%--<input type="text" class="form-text" value="Area (m2)" />--%>
			</div>
            <div class="clear"></div>
			<br />
            <div class="res_ad">
				<asp:DropDownList ID="ddlbedrooms" runat="server" CssClass="form-text wdth150">
                <asp:ListItem Text="Bedrooms" />
                    <asp:ListItem Text="1" />
                    <asp:ListItem Text="2" />
                    <asp:ListItem Text="3" />
                    <asp:ListItem Text="4" />
                    <asp:ListItem Text="5" />
                    <asp:ListItem Text="6" />
                    <asp:ListItem Text="7" />
                    <asp:ListItem Text="8" />
                    <asp:ListItem Text="9" />
                    <asp:ListItem Text="10" />
                </asp:DropDownList>
			</div>
            <div class="res_ad">
				<asp:DropDownList ID="ddlBathRooms" runat="server" CssClass="form-text wdth150">
                <asp:ListItem Text="Bath Rooms" />
                    <asp:ListItem Text="1" />
                    <asp:ListItem Text="2" />
                    <asp:ListItem Text="3" />
                    <asp:ListItem Text="4" />
                    <asp:ListItem Text="5" />
                    <asp:ListItem Text="6" />
                    <asp:ListItem Text="7" />
                    <asp:ListItem Text="8" />
                    <asp:ListItem Text="9" />
                    <asp:ListItem Text="10" />
                </asp:DropDownList>
			</div>
            <div class="clear"></div>
            </dt>
            
            <dt>
            	<p class="purple" style="padding:10px 0px 0px 0px;"><strong>Price</strong></p>
                <div style="height:5px;"></div>
                
             	<div class="res_ad">
                <asp:DropDownList ID="ddlPriceMode" runat="server" CssClass="form-text wdth150">
                    <asp:ListItem Text="Price Mode" />
                    <asp:ListItem Text="Residential Home" />
                    <asp:ListItem Text="Commercial Land" />
                </asp:DropDownList>
                     
				</div>
            
                <div class="res_ad">
                  <asp:TextBox ID="txtCurrency" runat="server" CssClass="form-text wdth150_inp" title="Currency" MaxLength="20" ></asp:TextBox>
                </div>

                <div class="res_ad">
                  <asp:TextBox ID="txtMinPrice" runat="server" CssClass="form-text wdth150_inp" MaxLength="20" title="Min (SR) " ></asp:TextBox>
                  
                </div>

                <div class="res_ad">
                  <asp:TextBox ID="txtMaxPrice" runat="server" CssClass="form-text wdth150_inp" MaxLength="20" title="Max (SR)" ></asp:TextBox>
                </div>
            
            	<div class="clear"></div>
            </dt>
            
            
            <dt>
            	<p class="purple"><strong>Contacts</strong></p>
                <div style="height:5px;"></div>
                
             	<div class="res_ad">
                    <asp:TextBox ID="txtContactName" runat="server" title="Contact Name" CssClass="form-text wdth150_inp"></asp:TextBox>
                    
				</div>
            
                <div class="res_ad">
                <asp:TextBox ID="txtContactNumber1" runat="server" title="Contact Number 1" CssClass="form-text wdth150_inp"></asp:TextBox>
                  
                </div>
                
                <div class="res_ad">
                  <asp:TextBox ID="txtContactNumber2" runat="server" title="Contact Number 2" CssClass="form-text wdth150_inp"></asp:TextBox>
                </div>
            
            	<div class="clear"></div>
            </dt>
            
             <dt>
              <label>
              <asp:CheckBox ID="chkNewsLatter" runat="server" />
              <span class="blue">Confirm Above Information </span></label>
            </dt>
            <dt>
            <asp:Button ID="cmdSave" runat="server" CssClass="reg-blue-round-btn w75" Text="Load" OnClick="btn_Save" /> 
            </dt>
          </dl>
        
    </div>
    </div>
</asp:Content>